package entity;

import lombok.Data;

import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

@Data
public class TeacherEntity {
    private String id;
    private String academyId;
    private String teacherName;
    private Integer age;
    private Integer gender;
    private String phoneNumber;
    private String degree;//学历

    public static TeacherEntity mapToEntity(Map<String, Object> objectMap) {
        TeacherEntity teacher = new TeacherEntity();
        teacher.setId((String) objectMap.get("id"));
        teacher.setAcademyId((String) objectMap.get("academy_id"));
        teacher.setTeacherName((String) objectMap.get("teacher_name"));
        teacher.setGender((Integer) objectMap.get("gender"));
        teacher.setAge((Integer) objectMap.get("age"));
        teacher.setPhoneNumber((String) objectMap.get("phone_number"));
        teacher.setDegree((String) objectMap.get("degree"));
        return teacher;
    }

    public static List<TeacherEntity> mapListToEntityList(List<Map<String, Object>> objectMapList) {
        return objectMapList.stream().map(TeacherEntity::mapToEntity).collect(Collectors.toList());
    }
}
